function main_gui
    % 创建图形界面
    fig = uifigure('Position', [100, 100, 600, 400], 'Name', '图像处理');
    
    % 创建一个2列的GridLayout
    layout = uigridlayout(fig, [1, 2]); % 1行，2列
    layout.ColumnWidth = {'1x', '3x'};  % 左侧列（按钮）占1x，右侧列（图像）占3x

    % 创建左侧的面板来容纳按钮
    panel_left = uipanel(layout, 'Title', '操作面板');  % 不需要再指定 'Layout' 属性
    panel_left.Layout.Row = 1;   % 第一行
    panel_left.Layout.Column = 1; % 第一列
    
    % 为 panel_left 设置 GridLayout
    panel_left_layout = uigridlayout(panel_left, [4, 1]);  % 4行1列布局
    panel_left_layout.RowHeight = {40, 40, 40, 40};  % 每行按钮高度 40
    panel_left_layout.ColumnWidth = {'1x'};  % 只有一列

    % 创建按钮并竖直排列
    btn_loadImage = uibutton(panel_left_layout, 'push', 'Text', '加载图像', 'ButtonPushedFcn', @(btn,event) loadImage(fig));
    btn_histogram = uibutton(panel_left_layout, 'push', 'Text', '显示直方图', 'ButtonPushedFcn', @(btn,event) showHistogram(fig));
    btn_gray = uibutton(panel_left_layout, 'push', 'Text', '灰度化', 'ButtonPushedFcn', @(btn,event) convertToGray(fig));
    btn_enhance = uibutton(panel_left_layout, 'push', 'Text', '增强对比度', 'ButtonPushedFcn', @(btn,event) enhanceContrast(fig));
    btn_histEqual = uibutton(panel_left_layout, 'push', 'Text', '直方图均衡化', 'ButtonPushedFcn', @(btn,event) histogramEqualization(fig));
    btn_histMatch = uibutton(panel_left_layout, 'push', 'Text', '直方图匹配', 'ButtonPushedFcn', @(btn,event) histogramMatching(fig));
    btn_linearEnhance = uibutton(panel_left_layout, 'push', 'Text', '线性增强', 'ButtonPushedFcn', @(btn,event) linearContrastEnhance(fig));
    btn_logEnhance = uibutton(panel_left_layout, 'push', 'Text', '对数增强', 'ButtonPushedFcn', @(btn,event) logarithmicContrastEnhance(fig));
    btn_expEnhance = uibutton(panel_left_layout, 'push', 'Text', '指数增强', 'ButtonPushedFcn', @(btn,event) exponentialContrastEnhance(fig));
    btn_scale = uibutton(panel_left_layout, 'push', 'Text', '图像缩放', 'ButtonPushedFcn', @(btn,event) scaleImage(fig));
    btn_rotate = uibutton(panel_left_layout, 'push', 'Text', '图像旋转', 'ButtonPushedFcn', @(btn,event) rotateImage(fig));
    btn_addNoise = uibutton(panel_left_layout, 'push', 'Text', '加噪声', 'ButtonPushedFcn', @(btn,event) addNoise(fig));
    btn_spatialFilter = uibutton(panel_left_layout, 'push', 'Text', '空域滤波', 'ButtonPushedFcn', @(btn,event) spatial_filtering(fig));
    btn_frequencyFilter = uibutton(panel_left_layout, 'push', 'Text', '频域滤波', 'ButtonPushedFcn', @(btn,event) frequencyFiltering(fig));
    btn_edgeDetection = uibutton(panel_left_layout, 'push', 'Text', '边缘检测', 'ButtonPushedFcn', @(btn,event) edgeDetection(fig));
    btn_extractTarget = uibutton(panel_left_layout, 'push', 'Text', '提取目标区域', 'ButtonPushedFcn', @(btn,event) extractTargetFromEdges(fig));


    % 添加其他按钮...

    % 创建右侧的图像显示区域
    ax = axes(layout);
    ax.Layout.Row = 1;
    ax.Layout.Column = 2;
    axis off; % 关闭坐标轴显示

    % 存储图像数据 (初始化时不需要调用 guidata)
    data.img = []; % 初始化图像数据
    data.ax = ax;  % 保存显示图像的 axes
    guidata(fig, data); % 将数据与 GUI 绑定
end